package cn.findviewbydream.entity;

import lombok.*;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.Pattern;
import java.util.Date;

/**********************************
 * 工程：cn.findviewbydream.entity
 * 作者：白雨濃 evil
 * 时间：17-6-1 下午10:05
 * 邮箱：evilbai@foxmail.com
 * 内容：用户实体类
 **********************************/
@Data
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class UserEntity
{
    @NotEmpty(message = "id不得为空")
    @Length(min = 1, max = 12, message = "id长度在1-12字符之间")
    @Pattern(regexp = "^[0-9a-zA_Z]+$", message = "账户为数字及字母组合")
    private String userId;

    @NotEmpty(message = "用户名不得为空")
    @Length(max = 12, message = "用户名长度不得超过12个字符")
    @Pattern(regexp = "^[\\u4e00-\\u9fa5_a-zA-Z0-9-]{1,12}$", message = "用户名不符合规范")
    private String name;

    @NotEmpty(message = "密码不得为空")
    @Length(min = 1, max = 12, message = "密码长度在1-12字符之间")
    private String password;

    private Date registerTime;
    private Date lastLoginTime;
}
